#define _CRT_SECURE_NO_WARNINGS 1

#include <string>
#include <iostream>
using namespace std;

class Solution
{
public:
    string countAndSay(int n)
    {
        string ret = "1";
        for (int i = 1; i < n; i++)
        {
            string tmp;
            int len = ret.size();
            for (int left = 0, right = 0; right < len; )
            {
                while (ret[left] == ret[right]) right++;
                tmp += to_string(right - left) + ret[left];
                left = right;
            }
            ret = tmp;
        }
        return ret;
    }
};

int main()
{
    Solution sol;
    string ret;
    ret = sol.countAndSay(6);
    for (auto e : ret)
    {
        cout << ret << " ";
    }
    cout << endl;
    return 0;
}